﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace FilesMerger
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryInfo di = new DirectoryInfo(Directory.GetCurrentDirectory());
            using (TextWriter writer = new StreamWriter(Path.Combine(di.FullName,"out.sql")))
            {
                foreach (var file in di.GetFiles("*.sql"))
                {
                    if(file.Name == "out.sql")
                        continue;
                    using (TextReader reader = new StreamReader(file.FullName))
                    {
                        Console.WriteLine(file.Name);
                        String content = reader.ReadToEnd();
                        writer.WriteLine();
                        writer.WriteLine();
                        writer.WriteLine("-----------"+file.Name+"--------------");
                        writer.Write(content);
                    }
                }
            }
        }
    }
}
